-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add proper JSDoc annotations to all public api and generate TS … #33
Conversation
* @property {Options} config the request configuration | ||
* @property {any} data the decoded response body | ||
* @property {T} data the decoded response body | ||
* @property {Headers} headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added all fields that are assigned to the response to properly match implementation (dunno if it's on purpose, or we wanna strictly "match" axios response - in that case those need to be removed + omit those within implementation)
* @public | ||
* @type {AbortController} | ||
*/ | ||
redaxios.CancelToken = /** @type {any} */ (self).AbortController || Object; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is TypeScript dom types issue as AbortController
is not defined on Window
interface
|
||
/* Strict Type-Checking Options */ | ||
"strict": true, /* Enable all strict type-checking options. */ | ||
"suppressImplicitAnyIndexErrors": true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easy up strict checks
// "strictFunctionTypes": true, /* Enable strict checking of function types. */ | ||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ | ||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ | ||
"noImplicitThis": false, /* Raise error on 'this' expressions with an implied 'any' type. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
easy up strict checks
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ | ||
}, | ||
"include": [ | ||
"src" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enable on src/
only (excluding tests)
@@ -35,6 +36,7 @@ | |||
"karmatic": "^1.4.0", | |||
"microbundle": "^0.11.0", | |||
"sinon": "^8.0.4", | |||
"typescript": "3.9.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't have to be as direct dep, microbundle will handle that in future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fantastic! Love it 🙌
*/ | ||
|
||
/** */ | ||
export default (function create(defaults) { | ||
export default (function create(/** @type {Options} */ defaults) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's easier to break the export and declaration out, I think microbundle+terser will collapse them all the same:
/** @param {Options} defaults */
function create() {
// ...
}
export default create();
"Compressed Size / build (pull_request)" fails, why ? Looking at "details" didn't helped me understand the issue here, this MR increased the pkg size too much ? |
The relevant error message is: src/index.js(210,25): error TS2339: Property 'withCredentials' does not exist on type 'Options'. Looks like there is a type error in the changes |
Closes #22
NOTES:
tsc
invoke can be removed when Add --generate-types option microbundle#589 lands to master